//此处把获到openId，与检索用户信息分开成两个函数
function getUserinfo() {
  var app = getApp()   
  var that = this
  var p = new Promise(function (resolve, reject) {
     //根据openid注册用户信息
     wx.request({
            url: 'https://www.beicho.com/get_userInfo.php', //接口地址 
            method: 'GET',
            header: {
              'content-type': 'application/json'
            },
            data: {
              openid: app.globalData.openid
            },
            success: res => {
             //console.log('查询到的数据2:',res.data)
              app.globalData.name = res.data.name
              app.globalData.phone = res.data.phone
              app.globalData.member = res.data.member
              app.globalData.time_end = res.data.time_end

              app.globalData.member_tb_shuxue = res.data.member_tb_shuxue
              app.globalData.member_tb_wuli = res.data.member_tb_wuli
              app.globalData.member_tb_huaxue= res.data.member_tb_huaxue

              app.globalData.member_zh_shuxue = res.data.member_zh_shuxue
              app.globalData.member_zh_wuli = res.data.member_zh_wuli
              app.globalData.member_zh_huaxue = res.data.member_zh_huaxue             
         
             //console.log('执行完成')
                resolve('success')
            }
          })  //request  
})  //promise结束
return p
}
//从模块内导出一个函数
module.exports.getUserinfo = getUserinfo;